var shopLogin = {};
//页面加载事件
$(function () {
    // 删除cookiy
    Cookie.deleteCookie("userid");

    //初始化标签页
    shopLogin.addEvent(this);
});
shopLogin.data = {};
shopLogin.addEvent = function (obj) {
    //切换到验证码
    $(".shop-login .shop-btn-tab-code").on("click", function (e) {
        $(".shop-login .shop-input-password").toggleClass("shop-code");
        if ($(".shop-login .shop-input-password").hasClass("shop-code")) {
            $(this).html("账户密码登录");
            $('.shop-input-group .shop-input[type="text"]').attr("placeholder", "手机号");
            $('.shop-input-group .shop-input[type="password"]').attr("placeholder", "请输入验证码");
        } else {
            $(this).html("短信验证码登录");
            $('.shop-input-group .shop-input[type="text"]').attr("placeholder", "邮箱手机号");
            $('.shop-input-group .shop-input[type="password"]').attr("placeholder", "请输入密码");
        }
    });
    $(".shop-input-password .shop-code-btn").on("click", function (e) {
        // 启动定时器
        var alltime = 60 * 1000;
        $(this).html("60s");
        var timer = setInterval(function () {
            alltime = alltime - 1000;
            var str = parseInt(alltime / 1000) + "s";
            $(".shop-code-btn").html(str.toString());
            if (alltime <= 0) {
                clearInterval(timer);
                $(".shop-code-btn").html("获取验证码");
            }
        }, 1000)
    });
};
shopLogin.methods = {};
//错误提示
shopLogin.methods.Error = function (errMessage) {
    if (errMessage == null || errMessage == "") {
        $(".shop-login .shop-erro-tips").removeClass("shop-active").html("");
    } else {
        $(".shop-login .shop-erro-tips").addClass("shop-active").html(errMessage);
        $(".shop-login .shop-erro-tips").focus();
    }
    $(".shop-login").not(".shop-erro-tips").on("click",function(){
        $(".shop-login .shop-erro-tips").removeClass("shop-active").html("");
    });
}